$import( "SmitearWebGL.Objects.Parser.Collada.DaeEntity" );
$import( "SmitearWebGL.Objects.Parser.Collada.DaeSurface" );
$import( "SmitearWebGL.Objects.Parser.Collada.DaeSampler2D" );

SmitearWebGL.Objects.Parser.Collada.DaeNewParam = SmitearWebGL.Objects.Parser.Collada.DaeEntity.extend(
{
	/******** constructor ********/

	init : function( document, node )
	{
		this.type = "";

		this.surface = null;

		this.sampler2D = null;

		this._super( document, node );
		this._registClass( "SmitearWebGL.Objects.Parser.Collada.DaeNewParam" );
	}
	,
	read : function( node )
	{
		$THROW( node.localName == SmitearWebGL.Objects.Parser.Collada.Const.DAE_FXCMN_NEWPARAM_ELEMENT,
		"expected a '" + SmitearWebGL.Objects.Parser.Collada.Const.DAE_FXCMN_NEWPARAM_ELEMENT + "' element" );

		this._super( node );

		$LOG( " => newparam @sid=" + this.sid );

		var children = node.childNodes;

		for( var i = 0; i < children.length; i++ )
		{
			var child = children[i];

			switch( child.localName )
			{
				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_FXCMN_SURFACE_ELEMENT:
					this.type = SmitearWebGL.Objects.Parser.Collada.Const.DAE_FXCMN_SURFACE_ELEMENT;
					this.surface = new SmitearWebGL.Objects.Parser.Collada.DaeSurface(this.document, child);
					break;

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_FXCMN_SAMPLER2D_ELEMENT:
					this.type = SmitearWebGL.Objects.Parser.Collada.Const.DAE_FXCMN_SAMPLER2D_ELEMENT;
					this.sampler2D = new SmitearWebGL.Objects.Parser.Collada.DaeSampler2D(this.document, child);
					break;

				default:
					break;
			}
		}
	}
}
);